package J11_24;

import java.util.Arrays;

public class test {
    public static void main(String[] args) {
        int[] arr = new int[]{1,1,1,1,3,4,5,6,3,};
        int n = arr.length;
        int max = 0;

        for (int j = 0;j < n - 1;j++) {
            max = arr[j]*arr[j+1]>max?max=arr[j]*arr[j+1]:max;
        }
    }

    public static void main3(String[] args) {
        int[] arr1 = new int[]{1,2,3,0,0,0};
        int[] arr2 = new int[]{3,3,4};
        merge(arr1,3,arr2,3);
        int[] arr3 = new int[10];
        Arrays.fill(arr3,1);
        System.arraycopy(arr1,0,arr3,5,5);

    }


    public static void merge(int A[], int m, int B[], int n) {
        int i = 0;
        int j = 0;
        int k = 0;
        int[] arr = new int[m + n];
        while (k < m + n) {
            if(i == m){
                arr[k] =B[j];
                k++;
                j++;
                continue;
            }
            if(j == n) {
                arr[k] = A[i];
                k++;
                i++;
                continue;
            }
            if(A[i] < B[j]) {
                arr[k] = A[i];
                i++;
                k++;
            }else {
                arr[k] = B[j];
                j++;
                k++;
            }
        }
        System.arraycopy(arr,0,A,0,m+n);
    }

    public String setstring (String str) {
        StringBuilder str1 = new StringBuilder();
        boolean[] arr = new boolean[100];
        Arrays.fill(arr,true);
        for(int i = 0;i<str.length();i++) {
            char ch = str.charAt(i);
            if(arr[ch - 'A']){
                arr[ch - 'A'] = false;
                str1.append(ch);
            }
        }


        return str1.toString();

    }
    public static void main2(String[] args) {
        int num = 2;
        switch (num) {
            case 1:
                ++num;
            case 2:
                ++num;
            case 3:
                ++num;
            case 4:
                ++num;
            default:
                ++num;

        }
        System.out.println(num);
    }

    public static void main1(String[] args) {
        pK("2134");
    }
    public static void pK(String str) {
        int len = str.length();
        char[] ch = str.toCharArray();
        int i = 0;
        while( i < len - 1){
            if(ch[i] != ch[i+1]){
                break;
            }
            if( i == len - 2){
                for (int j = 0; j < len; j++) {
                    System.out.print("0");
                }
                System.out.println();
                return;
            }
        }
        if(len == 3) {
            System.out.println("495");
            return;
        }else if(len == 4) {
            System.out.println("6174");
            return;
        }else {
            System.out.println("-1");
            return;
        }
    }
}
